#!/bin/bash

# Copyright (c) 2022 FuTeng
# FuYao-RepoPackageTest-System is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#          http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.

# #################################################
# @Author    :   futeng
# @Contact   :   lanshaa123@163.com
# @Desc      :   获取指定源软件包数目脚本
# @Note      :   宿主机需要安装docker
# #################################################

cd /root

# 禁用掉的软件源的repo id
testRepoId=REPOIDUNDERTEST

# 只抓取被测源软件包列表
yum list available --disablerepo=* --enablerepo=${testRepoId}|grep -v 'Available\|fastestmirror\|Loading\|可安装的软件包\|上次元数据过期检查\|Last\|*'|awk '{print $1}' > rp.list

cat rp.list | tr -s '\n' > repoPkgs.list 

# pkgNum=`cat repoPkgs.list  | wc -l`

# echo "pkgnum:$pkgNum"